<meta name="csrf-token" content="{{ csrf_token() }}">
<script src="{{URL::asset('js/echarts.js')}}"></script>
<script src="{{URL::asset('js/customed.js')}}"></script>
<script src="{{URL::asset('js/jspdf.min.js')}}"></script>
<script src="{{URL::asset('js/html2canvas.js')}}"></script>
<script src="{{URL::asset('js/jquery.js')}}"></script>
<style>
	.headDiv{
		height: 10mm;
		width: 210mm;
	}

	.area{
		height:24mm;
		width:180mm;
		background:none;
		resize:none;
		font-size:18px;
		border: 3px solid #b4b4b5;
		border-radius: 15px;
		color: #ffffff;
		background-color:#b4b4b5;
		overflow:hidden;
	}

	.temp{
		height:30mm;
		width:180mm;
		margin-left:15mm;
		float:left;
	}

	.DivF1{
		height: 75mm;
		width: 130mm;
		margin: 0 auto;
		margin: auto auto auto 10mm;
		float: left;
	}

	.DivF2{
		width: 60mm;
		margin: 40mm auto 0 auto;
		float: left;
		font-size:16px;
		color: #ffffff;
		position: relative;
		top: -20mm;
	}
	.DivF22 {
		width: 60mm;
		margin: 40mm auto 0 auto;
		float: left;
		font-size:16px;
		color: #ffffff;
	}
	.DivS_1{
		height: 74mm;
		width: 100mm;
		margin-left:10mm;
		float: left;
	}

	.DivS_2{
		height: 74mm;
		width: 100mm;
		margin: 0 auto;
		float: left;
	}

	.DivS_3{
		height:20mm;
		width:180mm;
		background:none;
		resize:none;
		font-size:14px;
		margin-left: 15mm;
		color: #ffffff;
		float: left;
		position: relative;
		top: -28px;
	}
	.DivR{
		height: 74mm;
		width: 200mm;
		padding:0 5mm 0 5mm;
		float: left;
	}
</style>
<div id="page-wrapper">
	<div class="box box-body" id="chart_container" style="width:210mm;padding:0 !important;margin: 0 auto;">
	</div>
	<div style="text-align: center;margin-top: 10mm;margin-bottom: 10mm;">
		<button id="btn_save" class="btn btn-success" style="width: 50mm;height: 20mm;font-size: larger;font-weight: bolder" onclick="save_memo()">保存评语</button>
		<button id="btn_pdf" class="btn btn-danger" style="width: 50mm;height: 20mm;font-size: larger;font-weight: bolder" onclick="o_window()">保存为PDF</button>
	</div>
	<div id="name_box" style="display:none;">
		<form class="form-inline">
			<div class="form-group">
				<label class="control-label">中文名：</label>
				<span class="form-control zh_name_in">
				</span>
			</div>
			<div class="form-group">
				<label class="control-label">英文名：</label>
				<span class="form-control en_name_in">
				</span>
			</div><br><br>
			<div class="form-group">
				<label class="control-label">营编号：</label>
				<span class="form-control camp_sn_in">
				</span>
			</div>
			<div class="form-group">
				<label class="control-label">班主任：</label>
				<span class="form-control tutor_in">
				</span>
			</div>
		</form>
	</div>
</div>
<script type="text/javascript">
var color = '';
var indicator = [];
var radar={person:[],camp:[]};
var Stuname = {};
$(document).ready(function(){
	var url = window.location.href;
	pid = url.split('=')[2];

	var request = {id:pid};
	$.ajaxSetup({headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},async:false});
	$.post('/admin/kly_report_get',request,function(e){
		var stu = e.student;
		var item = e.item;
		var common = e.common;
		var camp = e.camp;
		var i = 0;
		var memo = e.memo;
		var stu_id = "{{$id}}";

		var type1_html = '';
		var type3_html = '';
		var radar_html = '';
		var kaoqin_html = '';
		var image = '/upload/kly/test.png';

		for(let ii = 1;ii < 3; ii ++){
			var chart_container = document.getElementById("chart_container");
				html = '<div id="page'+ii+'-0" style="width:210mm;height:297mm;background:url('+camp.background+') no-repeat;background-size:210mm 297mm;margin:0;padding:0;"></div>';
				$('#chart_container').append(html);

				html = '<div style="color:white;font-family:PingFangSC-Semibold, sans-serif;font-size:7.3mm;line-height:16.5mm;float:left;margin-left:160mm;margin-top:11.5mm">';
				html += '<div>'+stu[stu_id].ch_name+'</div><div>'+stu[stu_id].en_name+'</div><div>'+e.camp_name+'</div><div>'+e.tutor+'</div></div>';
				html += '</div>';
				$('#page'+ii+'-0').append(html);
		}


		for(x in stu){
			if(x != parseInt(stu_id)){
				continue;
			}
			var url = camp.cover;
			Stuname.en_name = stu[x].en_name;
			Stuname.ch_name = stu[x].ch_name;

			var j = 0;
			for(t in item){
				if(item[t].item != "kaoqin" && item[t].item != "zuoye" && item[t].item != "test"){
					if(item[t].item == "reading"){
						var xData = [],pData = [],smData = [],bigData = [],totalMemo = "";
						for(it in item){
							if(item[it].item != "kaoqin" && item[it].item != "zuoye" && item[it].item != "test"){
								xData.push(item[it].name.split("落实度检测_")[1]);
								pData.push(stu[stu_id][item[it].item].avg);
								smData.push(common["small_"+item[it].item+"_avg"]);
								bigData.push(common["big_"+item[it].item+"_avg"]);
								totalMemo += stu[stu_id][item[it].item].score_memo+"<br>";
							}
						}
						var labelOption = {
						    normal: {
						        show: true,
						        position: "top",
						        fontSize: 16,
						        rich: {
						            name: {
						                textBorderColor: '#FFF'
						            }
						        }
						    }
						};
						var option = {
						    color:e.color.image,
						    calculable: true,
						    animation: false,
						    xAxis: [{
					            type:'category',
								axisLine: {
									lineStyle: {
										type: 'solid',
										color: "#FFF",//左边线的颜色
									},
									axisLabel: {
										textStyle: {
											color: e.color.text,//坐标值得具体的颜色
										}
									}
								},
					            data:xData
					        }],
						    yAxis: [{
					            type: 'value',
								axisLine: {
									lineStyle: {
										type: 'solid',
										color: e.color.axis,
									}
								},
								axisLabel: {
									textStyle: {
										color: e.color.text,

									}
								},
								splitLine:{
									lineStyle:{
										color:e.color.split
									}
								}
					        }],
						    series: [{
					            name: '个人',
					            label:labelOption,
					            type: 'bar',
					            data: pData
					        },{
					            name: '小营',
					            label:labelOption,
					            type: 'bar',
					            data: smData
					        },{
					            name: '大营',
					            label:labelOption,
					            type: 'bar',
					            data: bigData
					        }]
						};
						var lastHTML = '<div id="lastHTML" style="width: 100%;height: 100mm;position: relative;top: -21mm;"></div>';
						var legendHTML = '<div style="padding-top:70mm">\n' +
						'<div class="headDiv" style="background:url('+image+') no-repeat;width:120px;height:40px;background-size:120px 40px;line-height:40px;z-index: 1;color:#314499;font-size:20px;float:left;font-family: PingFangSC-Semibold, sans-serif;margin-left:70px;position: relative;top: -10mm;">落实度</div>\n' +

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #fff;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;position: relative;top: -10mm;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left;position: relative;top: -10mm;">个人</div>\n' +
						'</div>'+

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #fdd42a;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;position: relative;top: -10mm;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left;position: relative;top: -10mm;">小营</div>\n' +
						'</div>'+

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #b4b4b5;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;position: relative;top: -10mm;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left;position: relative;top: -10mm;">大营</div>\n' +
						'</div>'+
						'</div>';
						var memoHTML = '<div id="laseMemo" style="width: 80%;height: 25mm;margin-left: 10%;color:#FFF;text-align: justify;position: relative;top: -12mm;"></div>';
						$("#page2-0").html($("#page2-0").html() + legendHTML + lastHTML + memoHTML);
						var lastChart = echarts.init(document.getElementById("lastHTML"));
						lastChart.setOption(option);
						$("#laseMemo").html(totalMemo);
					}
				}else if(item[t].item == "test"){
					var testHTML = '<div style="width: 100%;height: 100mm;position: absolute;bottom: 10mm;"><div id="testC1" class="DivS_1" style="margin-top:20mm;"></div><div id="testC2" class="DivS_2" style="margin-top:20mm;"></div><div id="test_memo" style="width: 80%;margin-left:10%;color:#FFF;height: 15mm;bottom: 0;position: absolute;"></div></div>';
					var legendHTML = '<div style="position: absolute;bottom: 85mm;">\n' +
					'<div class="headDiv" style="background:url('+image+') no-repeat;width:120px;height:40px;background-size:120px 40px;line-height:40px;z-index: 1;color:#314499;font-size:20px;float:left;font-family: PingFangSC-Semibold, sans-serif;margin-left:70px;position: relative;top: -0mm;">测试</div>\n' +

					'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
					'<div style="width: 20px;height: 20px;background: #fff;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
					'\n' +
					'</div>\n' +
					'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">个人</div>\n' +
					'</div>'+

					'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
					'<div style="width: 20px;height: 20px;background: #fdd42a;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
					'\n' +
					'</div>\n' +
					'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">小营</div>\n' +
					'</div>'+

					'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
					'<div style="width: 20px;height: 20px;background: #b4b4b5;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
					'\n' +
					'</div>\n' +
					'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">大营</div>\n' +
					'</div>'+
					'</div>';
					$("#page2-0").html($("#page2-0").html() + testHTML + legendHTML);
					$("#test_memo").html(stu[stu_id].test.score_memo);
					// ????????????????????????
					var data = [];
						var tag = 0;

						data.push(stu[x][item[t].item].rate);
						data.push(common['small_'+item[t].item]);
						data.push(common['big_'+item[t].item]);
					var testopt1 = {
							tooltip: {},
							animation: false,
							xAxis: {
								type: 'category',
								axisLine: {
									lineStyle: {
										type: 'solid',
										color: e.color.axis,//左边线的颜色
									}
								},
								axisLabel: {
									textStyle: {
										color: e.color.text,//坐标值得具体的颜色

									}
								}
							},
							yAxis: {
								axisLine: {
									lineStyle: {
										type: 'solid',
										color: e.color.axis,//左边线的颜色
									}
								},
								axisLabel: {
									textStyle: {
										color: e.color.text,//坐标值得具体的颜色

									}
								},
								splitLine:{
									lineStyle:{
										color:e.color.split
									}
								}
							},
							color:e.color.image,
							series: [
								{type: 'bar',label: {normal: {
									show: true,
									position: 'top',
									color:e.color.image_display,
									formatter: '{a}\n{c}',
									fontSize: 16,
								}},data:[data[0]],name:'个人'},
								{type: 'bar',label: {normal: {
									show: true,
									position: 'top',
									color:e.color.image_display,
									formatter: '{a}\n{c}',
									fontSize: 16,
								}},data:[data[1]],name:'小营'},
								{type: 'bar',label: {normal: {
									show: true,
									position: 'top',
									color:e.color.image_display,
									formatter: '{a}\n{c}',
									fontSize: 16,
								}},data:[data[2]],name:'大营'}
							]
						};

						data = [];
						name = item[t].name+'分数';
						if(item[t].multi == 1){
							var title = [];
							for(d=1;d<=Object.keys(common['big_'+item[t].item+'_score']).length;d++){
								title.push('第'+d+'次');
							}
							var testopt2 = {
								animation: false,
								tooltip: {
									trigger: 'axis'
								},
								color:e.color.image,
								grid: {},
								xAxis: {
									type: 'category',
									boundaryGap: false,
									data:title,
									axisLine: {
										lineStyle: {
											type: 'solid',
											color: e.color.axis,//左边线的颜色
										}
									},
									axisLabel: {
										textStyle: {
											color: e.color.text,//坐标值得具体的颜色

										}
									}
								},
								yAxis: {
									type: 'value',
									axisLine: {
										lineStyle: {
											type: 'solid',
											color: e.color.axis,//左边线的颜色
										}
									},
									axisLabel: {
										textStyle: {
											color: e.color.text,//坐标值得具体的颜色

										}
									},
									splitLine:{
										lineStyle:{
											color:e.color.split
										}
									}
								},
								series: [
									{
										name:'个人',
										type:'line',
										data:Object.keys(stu[x][item[t].item].all).map(function (key) {
											return stu[x][item[t].item].all[key];
										}),
										itemStyle : { normal: {label : {show: true},textStyle:{color:e.color.text}}},
										lineStyle : {normal:{width:3}}
									},
									{
										name:'小营',
										type:'line',
										data:Object.keys(common['small_'+item[t].item+'_score']).map(function (key) {
											return common['small_'+item[t].item+'_score'][key];
										}),
										itemStyle : { normal: {label : {show: true},textStyle:{color:e.color.text}}},
										lineStyle : {normal:{width:3}}
									},
									{
										name:'大营',
										type:'line',
										data:Object.keys(common['big_'+item[t].item+'_score']).map(function (key) {
											return common['big_'+item[t].item+'_score'][key];
										}),
										itemStyle : { normal: {label : {show: true},textStyle:{color:e.color.text}}},
										lineStyle : {normal:{width:3}}
									}
								]
							};
						}else{
							data.push(stu[x][item[t].item].avg);
							data.push(common['small_'+item[t].item+'_avg']);
							data.push(common['big_'+item[t].item+'_avg']);
							var testopt2 = {
								animation: false,
								xAxis: {
									type: 'category',
									axisLine: {
										lineStyle: {
											type: 'solid',
											color: e.color.axis,//左边线的颜色
										}
									},
									axisLabel: {
										textStyle: {
											color: e.color.text,//坐标值得具体的颜色

										}
									}
								},
								yAxis: {
									axisLine: {
										lineStyle: {
											type: 'solid',
											color: e.color.axis,//左边线的颜色
										}
									},
									axisLabel: {
										textStyle: {
											color: e.color.text,//坐标值得具体的颜色

										}
									},
									splitLine:{
										lineStyle:{
											color:e.color.split
										}
									}
								},
								color:e.color.image,
								series: [
									{type: 'bar',label: {normal: {
										show: true,
										position: 'top',
										color:e.color.image_display,
										formatter: '{a}\n{c}',
										fontSize: 16,
									}},data:[data[0]],name:'个人'},
									{type: 'bar',label: {normal: {
										show: true,
										position: 'top',
										color:e.color.image_display,
										formatter: '{a}\n{c}',
										fontSize: 16,
									}},data:[data[1]],name:'小营'},
									{type: 'bar',label: {normal: {
										show: true,
										position: 'top',
										color:e.color.image_display,
										formatter: '{a}\n{c}',
										fontSize: 16,
									}},data:[7.62],name:'大营'}
								]
							};
						}
					setTimeout(function(){
						// echarts.init(document.getElementById("testC1")).setOption(testopt1);
						echarts.init(document.getElementById("testC1")).setOption(testopt2);
					},1);

				}else{
					if(item[t].item == 'radar'){
						radar_html = '<div style="padding-top:70mm">\n' +

						'<div class="headDiv" style="background:url('+image+') no-repeat;width:120px;height:40px;background-size:120px 40px;line-height:40px;z-index: 1;color:#314499;font-size:20px;float:left;font-family: PingFangSC-Semibold, sans-serif;margin-left:70px">多维能力图</div>\n' +

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #fff;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">个人</div>\n' +
						'</div>'+

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #fdd42a;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">小营</div>\n' +
						'</div>'+

						'    <div id="div1" class="DivR"></div>\n' +
						'    <div class="temp"><textarea type="text" class="area" id="area1"></textarea></div>\n' +
						'</div>';
						if(j % 2 == 0){
							radar_html = '<div>\n' +

							'<div class="headDiv" style="background:url('+image+') no-repeat;width:120px;height:40px;background-size:120px 40px;line-height:40px;z-index: 1;color:#314499;font-size:20px;float:left;font-family: PingFangSC-Semibold, sans-serif;margin-left:70px">多维能力图</div>\n' +

							'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
							'<div style="width: 20px;height: 20px;background: #fff;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
							'\n' +
							'</div>\n' +
							'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">个人</div>\n' +
							'</div>'+

							'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
							'<div style="width: 20px;height: 20px;background: #fdd42a;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
							'\n' +
							'</div>\n' +
							'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">小营</div>\n' +
							'</div>'+

							'<div style="clear:both">'+
							'    <div class="headDiv"></div>\n' +
							'    <div id="div1" class="DivR"></div>\n' +
							'</div>'+
							'</div>';
						}
					}
					if(item[t].item == 'kaoqin'){
						kaoqin_html = '<div style="padding-top:70mm">\n' +
						'    <div id="div1" class="DivF1"></div>\n' +
						'    <div id="div2" class="DivF2"></div>\n' +
						'</div>';
						
							kaoqin_html = '<div style="padding-top:70mm">\n' +
							'<div class="headDiv" style="background:url('+image+') no-repeat;width:120px;height:40px;background-size:120px 40px;line-height:40px;z-index: 1;color:#314499;font-size:20px;float:left;font-family: PingFangSC-Semibold, sans-serif;margin-left:70px">考勤全勤率</div>\n' +

							'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
							'<div style="width: 20px;height: 20px;background: #fff;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
							'\n' +
							'</div>\n' +
							'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">个人</div>\n' +
							'</div>'+

							'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
							'<div style="width: 20px;height: 20px;background: #fdd42a;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
							'\n' +
							'</div>\n' +
							'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">小营</div>\n' +
							'</div>'+

							'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
							'<div style="width: 20px;height: 20px;background: #b4b4b5;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
							'\n' +
							'</div>\n' +
							'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">大营</div>\n' +
							'</div>'+

							'    <div id="div1" class="DivF1" style="height:74mm"></div>\n' +
							'    <div id="div2" class="DivF22" style="margin:0;padding-top:20mm"></div>\n' +
							'</div>';
					}
					else if(item[t].item == 'zuoye') {
						type3_html = '<div style="float:left">\n' +

						'<div class="headDiv" style="background:url('+image+') no-repeat;width:120px;height:40px;background-size:120px 40px;line-height:40px;z-index: 1;color:#314499;font-size:20px;float:left;font-family: PingFangSC-Semibold, sans-serif;margin-left:70px;">作业准交率</div>\n' +

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #fff;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">个人</div>\n' +
						'</div>'+

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #fdd42a;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">小营</div>\n' +
						'</div>'+

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #b4b4b5;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">大营</div>\n' +
						'</div>'+

						'<div style="clear:both">' +
						'</div>'+
						'    <div id="div1" class="DivS_1"></div>\n' +
						'    <div id="div2" class="DivS_2" style="display:none;"></div>\n' +
						'    <div id="div3" class="DivS_3"></div>\n' +
						'</div>';
					}
					else if(item[t].type == 3 && item[t].item != 'zuoye'){
						type3_html = '<div style="float:left">\n' +

						'<div class="headDiv" style="background:url('+image+') no-repeat;width:120px;height:40px;background-size:120px 40px;line-height:40px;z-index: 1;color:#314499;font-size:20px;float:left;font-family: PingFangSC-Semibold, sans-serif;margin-left:70px;">'+item[t].name+'</div>\n' +

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #fff;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">个人</div>\n' +
						'</div>'+

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #fdd42a;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">小营</div>\n' +
						'</div>'+

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #b4b4b5;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">大营</div>\n' +
						'</div>'+

						'<div style="clear:both">' +
						'</div>'+
						'    <div id="div1" class="DivS_1"></div>\n' +
						'    <div id="div2" class="DivS_2"></div>\n' +
						'    <div id="div3" class="DivS_3"></div>\n' +
						'    <div class="temp"><textarea type="text" class="area" id="area1"></textarea></div>\n' +
						'</div>';
						if(j % 2 == 0){
							type3_html = '<div style="padding-top:70mm">\n' +
							'<div class="headDiv" style="background:url('+image+') no-repeat;width:120px;height:40px;background-size:120px 40px;line-height:40px;z-index: 1;color:#314499;font-size:20px;float:left;font-family: PingFangSC-Semibold, sans-serif;margin-left:70px;">'+item[t].name+'</div>\n' +

							'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
							'<div style="width: 20px;height: 20px;background: #fff;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
							'\n' +
							'</div>\n' +
							'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">个人</div>\n' +
							'</div>'+

							'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
							'<div style="width: 20px;height: 20px;background: #fdd42a;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
							'\n' +
							'</div>\n' +
							'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">小营</div>\n' +
							'</div>'+

							'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
							'<div style="width: 20px;height: 20px;background: #b4b4b5;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
							'\n' +
							'</div>\n' +
							'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">大营</div>\n' +
							'</div>'+
							'<div style="clear:both;">'+
							'    <div id="div1" class="DivS_1"></div>\n' +
							'    <div id="div2" class="DivS_2"></div>\n' +
							'    <div id="div3" class="DivS_3"></div>\n' +
							'</div>'+
							'</div>';
						}
					}
					else{
						type1_html = '<div style="clear:both;">\n' +

						'<div class="headDiv" style="background:url('+image+') no-repeat;width:280px;height:40px;background-size:280px 40px;line-height:40px;z-index: 1;color:#314499;font-size:20px;float:left;font-family: PingFangSC-Semibold, sans-serif;margin-left:70px;">'+item[t].name+'</div>\n' +

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #fff;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">个人</div>\n' +
						'</div>'+

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #fdd42a;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">小营</div>\n' +
						'</div>'+

						'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
						'<div style="width: 20px;height: 20px;background: #b4b4b5;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
						'\n' +
						'</div>\n' +
						'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">大营</div>\n' +
						'</div>'+

						'    <div id="div1" class="DivF1"></div>\n' +
						'    <div id="div2" class="DivF2"></div>\n' +
						'    <div class="temp"><textarea type="text" class="area" id="area1"></textarea></div>\n' +
						'</div>';
						if(j % 2 == 0){
							type1_html = '<div style="padding-top:70mm">\n' +

							'<div class="headDiv" style="background:url('+image+') no-repeat;width:280px;height:40px;background-size:280px 40px;line-height:40px;z-index: 1;color:#314499;font-size:20px;float:left;font-family: PingFangSC-Semibold, sans-serif;margin-left:70px;margin-top:2px">'+item[t].name+'</div>\n' +

							'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
							'<div style="width: 20px;height: 20px;background: #fff;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
							'\n' +
							'</div>\n' +
							'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">个人</div>\n' +
							'</div>'+

							'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
							'<div style="width: 20px;height: 20px;background: #fdd42a;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
							'\n' +
							'</div>\n' +
							'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">小营</div>\n' +
							'</div>'+

							'<div style="width:20px;width:40px;float:left;margin-left:10px;margin-top:2px">\n' +
							'<div style="width: 20px;height: 20px;background: #b4b4b5;-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;">\n' +
							'\n' +
							'</div>\n' +
							'<div style="width:40px;color:white;font-family:PingFangSC-Semibold, sans-serif;text-align:left">大营</div>\n' +
							'</div>'+

							'<div style="clear:both">'+
							'    <div id="div1" class="DivF1"></div>\n' +
							'    <div id="div2" class="DivF2"></div>\n' +
							'</div>'+
							'</div>';
						}
					}
					if(item[t].item == 'radar'){
						$('#page'+(Math.floor(j/2)+1)+'-'+i).append(radar_html);
						var dom1 = document.getElementById("div1");
						var myChart1 = echarts.init(dom1);

						option = {
							animation: false,
							title: {
								text: ''
							},
							tooltip: {},
							color:e.color.image,
							radar: {
								name: {
									textStyle: {
										color: e.color.text,
										//backgroundColor: '#999',
										borderRadius: 3,
										padding: [3, 5],
										fontSize:25
									}
								},
								indicator: indicator,
								startAngle:45
							},
							series: [{
								type: 'radar',
								data : [
									{
										value : radar.person,
										name : '个人'
									},
									{
										value : radar.camp,
										name : '小营'
									}
								]
							}]
						};
						myChart1.setOption(option);
						continue;
					}
					if(item[t].type == 3){
						var temp_indi = {};
						temp_indi.name = item[t].name+'分数';
						temp_indi.max = 100;
						indicator.push(temp_indi);

						var temp_indi = {};
						temp_indi.name = item[t].name+'正常率';
						temp_indi.max = 100;
						indicator.push(temp_indi);

						radar.person.push(stu[x][item[t].item].avg);
						radar.person.push(stu[x][item[t].item].rate);
						radar.camp.push(common['small_'+item[t].item+'_avg']);
						radar.camp.push(common['small_'+item[t].item]);

						if(item[t].item != "kaoqin"){
							$('#page'+(Math.floor(j/2)+1)+'-'+i).append(type3_html);
						}
						var dom1 = document.getElementById("div1");
						var myChart1 = echarts.init(dom1);
						var data = [];
						var tag = 0;

						data.push(stu[x][item[t].item].rate);
						data.push(common['small_'+item[t].item]);
						data.push(common['big_'+item[t].item]);

						var name = '';
						if(item[t].name == '考勤'){
							name = item[t].name+"全勤率";
						}else if(item[t].name == '测试' || item[t].name == '家校' || item[t].name == '作业' || item[t].name == '听写'){
							name = item[t].name+"准交率";
						}else{
							name = item[t].name+"正常率";
						}
						option = {
							animation: false,
							tooltip: {},
							xAxis: {
								type: 'category',
								axisLine: {
									lineStyle: {
										type: 'solid',
										color: e.color.axis,//左边线的颜色
									}
								},
								axisLabel: {
									textStyle: {
										color: e.color.text,//坐标值得具体的颜色

									}
								}
							},
							yAxis: {
								axisLine: {
									lineStyle: {
										type: 'solid',
										color: e.color.axis,//左边线的颜色
									}
								},
								axisLabel: {
									textStyle: {
										color: e.color.text,//坐标值得具体的颜色

									}
								},
								splitLine:{
									lineStyle:{
										color:e.color.split
									}
								}
							},
							color:e.color.image,
							series: [
								{type: 'bar',label: {normal: {
									show: true,
									position: 'top',
									color:e.color.image_display,
									formatter: '{a}\n{c}',
									fontSize: 16,
								}},data:[data[0]],name:'个人'},
								{type: 'bar',label: {normal: {
									show: true,
									position: 'top',
									color:e.color.image_display,
									formatter: '{a}\n{c}',
									fontSize: 16,
								}},data:[data[1]],name:'小营'},
								{type: 'bar',label: {normal: {
									show: true,
									position: 'top',
									color:e.color.image_display,
									formatter: '{a}\n{c}',
									fontSize: 16,
								}},data:[data[2]],name:'大营'}
							]
						};
						myChart1.setOption(option);


						data = [];
						name = item[t].name+'分数';
						if(item[t].multi == 1){
							var title = [];
							for(d=1;d<=Object.keys(common['big_'+item[t].item+'_score']).length;d++){
								title.push('第'+d+'次');
							}
							option = {
								animation: false,
								tooltip: {
									trigger: 'axis'
								},
								color:e.color.image,
								grid: {},
								xAxis: {
									type: 'category',
									boundaryGap: false,
									data:title,
									axisLine: {
										lineStyle: {
											type: 'solid',
											color: e.color.axis,//左边线的颜色
										}
									},
									axisLabel: {
										textStyle: {
											color: e.color.text,//坐标值得具体的颜色

										}
									}
								},
								yAxis: {
									type: 'value',
									axisLine: {
										lineStyle: {
											type: 'solid',
											color: e.color.axis,//左边线的颜色
										}
									},
									axisLabel: {
										textStyle: {
											color: e.color.text,//坐标值得具体的颜色

										}
									},
									splitLine:{
										lineStyle:{
											color:e.color.split
										}
									}
								},
								series: [
									{
										name:'个人',
										type:'line',
										data:Object.keys(stu[x][item[t].item].all).map(function (key) {
											return stu[x][item[t].item].all[key];
										}),
										itemStyle : { normal: {label : {show: true},textStyle:{color:e.color.text}}},
										lineStyle : {normal:{width:3}}
									},
									{
										name:'小营',
										type:'line',
										data:Object.keys(common['small_'+item[t].item+'_score']).map(function (key) {
											return common['small_'+item[t].item+'_score'][key];
										}),
										itemStyle : { normal: {label : {show: true},textStyle:{color:e.color.text}}},
										lineStyle : {normal:{width:3}}
									},
									{
										name:'大营',
										type:'line',
										data:Object.keys(common['big_'+item[t].item+'_score']).map(function (key) {
											return common['big_'+item[t].item+'_score'][key];
										}),
										itemStyle : { normal: {label : {show: true},textStyle:{color:e.color.text}}},
										lineStyle : {normal:{width:3}}
									}
								]
							};
						}else{
							data.push(stu[x][item[t].item].avg);
							data.push(common['small_'+item[t].item+'_avg']);
							data.push(common['big_'+item[t].item+'_avg']);
							option = {
								animation: false,
								xAxis: {
									type: 'category',
									axisLine: {
										lineStyle: {
											type: 'solid',
											color: e.color.axis,//左边线的颜色
										}
									},
									axisLabel: {
										textStyle: {
											color: e.color.text,//坐标值得具体的颜色

										}
									}
								},
								yAxis: {
									axisLine: {
										lineStyle: {
											type: 'solid',
											color: e.color.axis,//左边线的颜色
										}
									},
									axisLabel: {
										textStyle: {
											color: e.color.text,//坐标值得具体的颜色

										}
									},
									splitLine:{
										lineStyle:{
											color:e.color.split
										}
									}
								},
								color:e.color.image,
								series: [
									{type: 'bar',label: {normal: {
										show: true,
										position: 'top',
										color:e.color.image_display,
										formatter: '{a}\n{c}',
										fontSize: 16,
									}},data:[data[0]],name:'个人'},
									{type: 'bar',label: {normal: {
										show: true,
										position: 'top',
										color:e.color.image_display,
										formatter: '{a}\n{c}',
										fontSize: 16,
									}},data:[data[1]],name:'小营'},
									{type: 'bar',label: {normal: {
										show: true,
										position: 'top',
										color:e.color.image_display,
										formatter: '{a}\n{c}',
										fontSize: 16,
									}},data:[data[2]],name:'大营'}
								]
							};
						}

						var dom2 = document.getElementById("div2");
						var myChart2 = echarts.init(dom2);
						myChart2.setOption(option);

						if(typeof(stu[x][item[t].item].score_memo) != "undefined"){
							$('#div3').text(stu[x][item[t].item].score_memo);
						}else{
							$('#div3').text(stu[x][item[t].item].rate_memo);
						}

						if(memo != null && typeof(memo[j]) != "undefined" && memo[j] != "undefined"){
							$('#area1').text(memo[j]);
						}
						$('#div1').removeAttr('id');
						$('#div2').removeAttr('id');
						$('#div3').removeAttr('id');
						$('#area1').removeAttr('id');
					}
					else{
						if(item[t].item == "kaoqin"){
							$('#page1-0').append(kaoqin_html);
						}else{
							$('#page'+(Math.floor(j/2)+1)+'-'+i).append(type1_html);
						}
						var dom1 = document.getElementById("div1");
						var myChart1 = echarts.init(dom1);
						var data = [];
						var tag = 0;
						var name = '';
						if(item[t].type == 1){
							data.push(stu[x][item[t].item].rate);
							data.push(common['small_'+item[t].item]);
							data.push(common['big_'+item[t].item]);

							var temp_indi = {};
							temp_indi.name = item[t].name+'正常率';
							temp_indi.max = 100;
							indicator.push(temp_indi);

							radar.person.push(stu[x][item[t].item].rate);
							radar.camp.push(common['small_'+item[t].item]);

							if(item[t].name == '考勤'){
								name = item[t].name+"全勤率";
							}else if(item[t].name == '测试' || item[t].name == '家校' || item[t].name == '作业' || item[t].name == '听写'){
								name = item[t].name+"准交率";
							}else{
								name = item[t].name+"正常率";
							}
						}
						else{
							var temp_indi = {};
							temp_indi.name = item[t].name+'分数';
							temp_indi.max = 100;
							indicator.push(temp_indi);
							radar.person.push(stu[x][item[t].item].avg);
							radar.camp.push(common['small_'+item[t].item]);
							if(item[t].multi == 1){
								tag = 1;
							}else{
								data.push(stu[x][item[t].item].avg);
								data.push(common['small_'+item[t].item+'_avg']);
								data.push(common['big_'+item[t].item+'_avg']);
							}
							name = item[t].name+'分数';
						}
						if(tag == 1){
							var title = [];
							for(d=1;d<=Object.keys(common['big_'+item[t].item+'_score']).length;d++){
								title.push('第'+d+'次');
							}
							option = {
								animation: false,
								tooltip: {
									trigger: 'axis'
								},
								color:e.color.image,
								grid: {},
								xAxis: {
									type: 'category',
									boundaryGap: false,
									data:title,
									axisLine: {
										lineStyle: {
											type: 'solid',
											color: e.color.axis,//左边线的颜色
										}
									},
									axisLabel: {
										textStyle: {
											color: e.color.text,//坐标值得具体的颜色

										}
									}
								},
								yAxis: {
									type: 'value',
									axisLine: {
										lineStyle: {
											type: 'solid',
											color: e.color.axis,//左边线的颜色
										}
									},
									axisLabel: {
										textStyle: {
											color: e.color.text,//坐标值得具体的颜色

										}
									},
									splitLine:{
										lineStyle:{
											color:e.color.split
										}
									}
								},
								series: [
									{
										name:'个人',
										type:'line',
										data:Object.keys(stu[x][item[t].item].all).map(function (key) {
											return stu[x][item[t].item].all[key];
										}),
										itemStyle : { normal: {label : {show: true},textStyle:{color:e.color.text}}},
										lineStyle : {normal:{width:3}}
									},
									{
										name:'小营',
										type:'line',
										data:Object.keys(common['small_'+item[t].item+'_score']).map(function (key) {
											return common['small_'+item[t].item+'_score'][key];
										}),
										itemStyle : { normal: {label : {show: true},textStyle:{color:e.color.text}}},
										lineStyle : {normal:{width:3}}
									},
									{
										name:'大营',
										type:'line',
										data:Object.keys(common['big_'+item[t].item+'_score']).map(function (key) {
											return common['big_'+item[t].item+'_score'][key];
										}),
										itemStyle : { normal: {label : {show: true},textStyle:{color:e.color.text}}},
										lineStyle : {normal:{width:3}}
									}
								]
							};
						}
								else{
							option = {
								animation: false,
								color:e.color.image,
								xAxis: {
									type: 'category',
									axisLine: {
										lineStyle: {
											type: 'solid',
											color: e.color.axis,//左边线的颜色
										}
									},
									axisLabel: {
										textStyle: {
											color: e.color.text,//坐标值得具体的颜色

										}
									}
								},
								yAxis: {
									axisLine: {
										lineStyle: {
											type: 'solid',
											color: e.color.axis,//左边线的颜色
										}
									},
									axisLabel: {
										textStyle: {
											color: e.color.text,//坐标值得具体的颜色

										}
									},
									splitLine:{
										lineStyle:{
											color:e.color.split
										}
									}
								},
								series: [
									{type: 'bar',label: {normal: {
										show: true,
										position: 'top',
										color:e.color.image_display,
										formatter: '{a}\n{c}',
										fontSize: 16,
									}},data:[data[0]],name:'个人'},
									{type: 'bar',label: {normal: {
										show: true,
										position: 'top',
										color:e.color.image_display,
										formatter: '{a}\n{c}',
										fontSize: 16,
									}},data:[data[1]],name:'小营'},
									{type: 'bar',label: {normal: {
										show: true,
										position: 'top',
										color:e.color.image_display,
										formatter: '{a}\n{c}',
										fontSize: 16,
									}},data:[data[2]],name:'大营'}
								]
							};
						}

						myChart1.setOption(option);
						if(typeof(stu[x][item[t].item].score_memo) != "undefined"){
							$('#div2').text(stu[x][item[t].item].score_memo);
						}else{
							$('#div2').text(stu[x][item[t].item].rate_memo);
						}
						if(memo != null && typeof(memo[j]) != "undefined" && memo[j] != "undefined"){
							$('#area1').text(memo[j]);
						}
						$('#div1').removeAttr('id');
						$('#div2').removeAttr('id');
						$('#area1').removeAttr('id');
					}

				}
				j++;
			}
			i++;
		}
		setTimeout(function(){
			o_window();
		},1000);
	});
});
function o_window(){
	var wi = window.open('about:blank', '_blank');

	wi.document.write(document.getElementById('chart_container').outerHTML);
	var listnew = wi.document.getElementsByTagName("canvas");
	var listold = document.getElementsByTagName("canvas");
	for(i=0;i<listold.length;i++){
		var ctx = listold[i].getContext('2d');
		var imgdata = ctx.getImageData(0,0,2500,7500);
		var ctxnew = listnew[i].getContext('2d');
		ctxnew.putImageData(imgdata,0,0);
	}
	var style = wi.document.createElement("style");
	style.innerHTML = '    .headDiv{\n' +
	'        height: 10mm;\n' +
	'        width: 210mm;\n' +
	'    }\n' +
	'\n' +
	'    .area{\n' +
	'        height:24mm;\n' +
	'        width:180mm;\n' +
	'        background:none;\n' +
	'        resize:none;\n' +
	'        font-size:18px;\n' +
	'        border: 3px solid #b4b4b5;\n' +
	'        border-radius: 15px;\n' +
	'        color: #ffffff;\n' +
	'\t\tbackground-color:#b4b4b5;\n' +
	'\t\toverflow:hidden;\n' +
	'    }\n' +
	'\n' +
	'    #page2-0{position:relative;}\n' +
	'    .temp{\n' +
	'        height:30mm;\n' +
	'        width:180mm;\n' +
	'        margin-left:15mm;\n' +
	'        float:left;\n' +
	'    }\n' +
	'\n' +
	'    .DivF1{\n' +
	'        height: 75mm;\n' +
	'        width: 130mm;\n' +
	'        margin: 0 auto;\n' +
	'        margin: auto auto auto 10mm;\n' +
	'        float: left;\n' +
	'    }\n' +
	'\n' +
	'    .DivF2{\n' +
	'        width: 60mm;\n' +
	'        margin: 40mm auto 0 auto;\n' +
	'        float: left;\n' +
	'        font-size:16px;\n' +
	'        color: #ffffff;position: relative;	top: -20mm;\n' +
	'    }\n' +
	'\n' +
	'    .DivF22{\n' +
	'        width: 60mm;\n' +
	'        margin: 40mm auto 0 auto;\n' +
	'        float: left;\n' +
	'        font-size:16px;\n' +
	'        color: #ffffff;\n' +
	'    }\n' +
	'\n' +
	'    .DivS_1{\n' +
	'        height: 74mm;\n' +
	'        width: 100mm;\n' +
	'        margin-left:10mm;\n' +
	'        float: left;\n' +
	'    }\n' +
	'\n' +
	'    .DivS_2{\n' +
	'        height: 74mm;\n' +
	'        width: 100mm;\n' +
	'        margin: 0 auto;\n' +
	'        float: left;\n' +
	'    }\n' +
	'\n' +
	'    .DivS_3{\n' +
	'        height:20mm;\n' +
	'        width:180mm;\n' +
	'        background:none;\n' +
	'        resize:none;\n' +
	'        font-size:14px;\n' +
	'        margin-left: 15mm;\n' +
	'        color: #ffffff;\n' +
	'        float: left;position: relative;top: -28px;\n' +
	'    }\n' +
	'\t.DivR{\n' +
	'\t\theight: 74mm;\n' +
	'\t\twidth: 200mm;\n' +
	'\t\tpadding:0 5mm 0 5mm;\n' +
	'\t\tfloat: left;\n' +
	'\t}';
	wi.document.head.appendChild(style);

	var div1 = wi.document.getElementById("chart_container");
	/*            div1.style.position = 'fixed';
	div1.style.top = '0px';
	div1.style.left = '0px';*/

	wi.opener.export_pdf(div1);
	setTimeout(function(){
		wi.close();
	},1200);
}

function export_pdf(div1){
	var contentWidth = 0;
	var contentHeight = 0;
	var w = parseInt(window.getComputedStyle(div1).width);
	var h = parseInt(window.getComputedStyle(div1).height);
	var canvas1 = document.createElement("canvas");

	html2canvas(div1, {canvas:canvas1,width:div1.offsetWidth,height:div1.offsetHeight,logging:false,scale:1}).then(function(canvas) {
		contentWidth = canvas.width;
		contentHeight = canvas.height;
		//一页pdf显示html页面生成的canvas高度;
		var pageHeight = contentWidth / 595.28 * 841.89;
		//未生成pdf的html页面高度
		var leftHeight = contentHeight;
		//页面偏移
		var position = 0;
		//a4纸的尺寸[595.28,841.89]，html页面生成的canvas在pdf中图片的宽高
		var imgWidth = 595.28;
		var imgHeight = 595.75 / contentWidth * contentHeight;
		//canvas.getContext("2d").translate(-500,-20);
		var pageData = canvas.toDataURL('image/jpeg', 0.95);
		//console.log(pageData);
		//注①
		var pdf = new jsPDF('', 'pt', 'a4');
		//有两个高度需要区分，一个是html页面的实际高度，和生成pdf的页面高度(841.89)
		//当内容未超过pdf一页显示的范围，无需分页
		if (leftHeight < pageHeight) {
			pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight);
		} else {
			while (leftHeight > 0) {
				//arg3-->距离左边距;arg4-->距离上边距;arg5-->宽度;arg6-->高度
				pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
				leftHeight -= pageHeight;
				position -= 841.89;
				//避免添加空白页
				if (leftHeight > 100) {
					//注②
					pdf.addPage();
				}
			}
		}
		pdf.save(Stuname.en_name+'-'+Stuname.ch_name+'.pdf');
	});
}

function save_memo(){
	var url = window.location.href;
	pid = url.split('=')[2];

	var area_list = $('.area');
	var memo = [];
	var request = {pid:pid};
	for(i=0;i<area_list.length;i++){
		memo.push(area_list[i].value);
	}
	request.memo = JSON.stringify(memo);

	$.ajaxSetup({headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},async:false});
	$.post('/admin/kly_report/save_memo',request,function(e){
		alert('操作成功');
	})
}
</script>
